﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Proxy
{
    class ProxySeacher : ISeacher
    {
        private ISeacher seacher = new RealSeacher();
        private AccessValidate AccessValidate;
        private Logger Logger;
        public string DoSeacher(string userId, string keyId)
        {
            if (this.Validate(userId))
            {
                seacher.DoSeacher(userId,keyId);
                this.Log(userId);
                return "登录成功";
            }
            
            return "登录失败";
        }
        public bool Validate(string userId)
        {
            AccessValidate = new AccessValidate();
            return AccessValidate.Validate(userId);
        }

        public void Log(string userId)
        {
            Logger = new Logger();
            Logger.Log(userId);
        }
    }
}
